package org.example.camundaengine.listeners;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

/**
 * @Description:
 */

@Component
@Slf4j
public class CheckHomeAddress implements ExecutionListener {
    @Override
    public void notify(DelegateExecution execution) throws Exception {
        log.info("校验地址开始");
        String homeAddress = (String) execution.getVariable("homeAddress");
        if (StringUtils.isBlank(homeAddress)) {
            log.info("未获取到地址");
            execution.setVariable("homeAddress", "默认地址");
        }
    }
}
